package com.scsj.supermarket.presenter;

import android.util.Log;

import com.orhanobut.logger.Logger;
import com.scsj.supermarket.base.AlterPayPwdBase;
import com.scsj.supermarket.base.SelectTackCashByPageInfoBase;
import com.scsj.supermarket.bean.BaseBean;
import com.scsj.supermarket.bean.SelectTackCashByPageInfoBean;
import com.scsj.supermarket.model.AlterPayPwdModel;
import com.scsj.supermarket.model.SelectTackCashByPageInfoModel;

import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 提现记录列表presenter
 */

public class SelectTackCashByPageInfoPresenter extends BasePresenter implements SelectTackCashByPageInfoBase.IPresenter {

    private SelectTackCashByPageInfoBase.IModel mModel;
    private SelectTackCashByPageInfoBase.IView mView;

    public SelectTackCashByPageInfoPresenter(SelectTackCashByPageInfoBase.IView view) {
        mView = view;
        mModel = new SelectTackCashByPageInfoModel();
    }


    @Override
    public void deliverData(RequestBody requestBody) {
        addSubscription(mModel.getData(requestBody, new ResponseCallback<SelectTackCashByPageInfoBean>() {
            @Override
            public void onSuccess(SelectTackCashByPageInfoBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showSuccessMsg("提现记录获取成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("提现记录获取onFaild", msg + "");
            }
        }));
    }

}
